/**
 * 神州信息(2012)
 */
package net.abbp.report.view.cell.value;

import net.abbp.report.model.ReportModel;
import net.abbp.report.model.io.IValueIO;

import org.dom4j.Element;

/**
 * 图形对象
 * 
 * @version 1.0
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ABBP 1.0
 * 
 *        Date：2012-4-16
 */
public class ImageValue extends AbstractCellObject {
    // Image Base64数据
    private String data;

    @Override
    public String toString() {
        return "Image";
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getData() {
        return data;
    }

    public static class IO implements IValueIO {
        @Override
        public Object read(Element value, ReportModel model) {
            ImageValue rtn = new ImageValue();
            rtn.setData(value.getTextTrim());

            return rtn;
        }

        @Override
        public void write(Element element, Object value) {
            element.addText(((ImageValue) value).getData());
        }

    }

}
